//
//  FirstVCTableViewCell.m
//  WuliHanhan
//
//  Created by tang on 16/3/16.
//  Copyright © 2016年 LVpeng. All rights reserved.
//

#import "FirstVCTableViewCell.h"
#import "Header.h"



//#import "UIImageView+AFNetworking.h"
#import "UIImageView+WebCache.h"

@interface FirstVCTableViewCell ()


@property (nonatomic, strong) UILabel *titleLable;
@property (nonatomic, strong) UIImageView *backIMageView;
@property (nonatomic, strong) UILabel *detalLable;
@property (nonatomic, strong) UIImageView *typeIMageView;


@end





@implementation FirstVCTableViewCell





- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self initUI];
        
    }
    return self;
}




- (void)initUI
{
    UIImage *image = nil;
    
    image = [UIImage imageNamed:@"BGview.png"];
    self.backIMageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WithView, 399.0/2.0)];
    [_backIMageView setContentMode:UIViewContentModeScaleAspectFill];
    [_backIMageView.layer setMasksToBounds:YES];
    
    [self addSubview:self.backIMageView];
    
    
    self.titleLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 81, WithView, 30.0)];
    [self.titleLable setTextAlignment:NSTextAlignmentCenter];
    [self.titleLable setTextColor:[UIColor whiteColor]];
    [self addSubview:self.titleLable];
    

    self.typeIMageView = [[UIImageView alloc] initWithFrame:CGRectMake(WithView/2.0-65.0/2.0, CGRectGetMaxY(self.titleLable.frame), 65, 22)];
    [self.typeIMageView setImage:image];
    [self addSubview:self.typeIMageView];
    
    self.detalLable = [[UILabel alloc] initWithFrame:_typeIMageView.bounds];
    [self.detalLable setTextColor:[UIColor whiteColor]];
    [self.detalLable setFont:[UIFont systemFontOfSize:12.0]];
    [self.detalLable setTextAlignment:NSTextAlignmentRight];
    [_typeIMageView addSubview:self.detalLable];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(9, 4, 20, 15)];
    image = [UIImage imageNamed:@"Shapeimage.png"];
    [imageView setImage:image];
    [self.typeIMageView addSubview:imageView];

}


- (void)setModel:(NSDictionary *)dic
{
    [self.backIMageView sd_setImageWithURL:[NSURL URLWithString:[[dic valueForKey:@"data"] valueForKey:@"imageUrl"]]];
    [self.titleLable setText:[[dic valueForKey:@"data"] valueForKey:@"title"]];
    [self.detalLable setText:[NSString stringWithFormat:@"%d张", [[[dic valueForKey:@"data"] valueForKey:@"imageCount"] intValue]]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
